class Book {
    String name;
    String writer;
    String press;
    String date;

    public void settername(String name) {
        this.name= name;
    }

    public String gettername() {
        return name;
    }

    public void setterwriter(String writer) {
        this.writer = writer;
    }

    public String getterwriter() {
        return writer;
    }

    public void setterpress(String press) {
        this.press = press;
    }

    public String getterpress() {
        return press;
    }

    public void setterdate(String date) {
        this.date = date;
    }

    public String getterdate() {
        return date;
    }
    public String toString() {     //覆盖了父类Object中的toString方法。
        return  "书名是：" + name + "\n" +
                "作者是：" + writer + "\n" +
                "出版社是：" + press + "\n" +
                "出版时间是：" + date + "\n";
    }

    public boolean equals(Object lei) {    //覆盖了父类Object中的equlas方法。
         Book book = (Book) lei;
         if (!name.equals(book.name))
            return false;
         if (!writer.equals(book.writer))
            return false;
         if (!press.equals(book.press))
            return false;
         if (!date.equals(book.date))
            return false;
        return true;
    }

}

